/*
  Name: DeadProyClientManger.h
  Copyright:
  Author: Carl Chatfield
  Date: 06/01/08 12:16
  Description: Used for storing and retrieving information about clients running through the proxy
*/

#ifndef __DEADPROXYFRMCLIENTMANAGER_h__
#define __DEADPROXYFRMCLIENTMANAGER_h__

#ifdef __BORLANDC__
	#pragma hdrstop
#endif

#ifndef WX_PRECOMP
	#include <wx/wx.h>
#else
	#include <wx/wxprec.h>
#endif

#include "DeadProxyClient.h"

WX_DECLARE_OBJARRAY(Client, ArrayOfClients);

class ClientManager
{
    private:
        ArrayOfClients * Clients;
        wxMutex * mutex;
	public:
        Client * GetClientByPos(unsigned int pos);
        int GetCount();
        int GetPosByPid(int pid);
        int GetPosByCharName(wxString name);
        void RemoveClient(int pos);
        void AddClient(int pid, void* handle, bool isStandAlone);
        
        int GetClientWithConnectStatus(int status, int * i);
        void GetConnectingCharacterInfo(int i, int * ip, short * port);
        //void SetLogPacketMode(int i, int mode);
        //int GetLogPacketMode(int i);
        wxString * GetPacketString(int i, int n);
        //void ClearPacketLog(int i);
        //wxArrayString * GetListBoxArray(int i);
        //void SetSelected(int i);
        void PostEventToClient(int i, ClientEvent * evt);
        void BroadcastEvent(ClientEvent * evt);
        //All other Get functions use pos
        char * GetKey(int pos);

        ClientManager();
};

#endif
